//
//  besiTableViewController.swift
//  mywei
//
//  Created by myd on 15/12/15.
//  Copyright © 2015年 myd1. All rights reserved.
//

import UIKit

class besiTableViewController: UITableViewController {
  
    private
    var us1 = user1.loadboo()
    lazy  var view1 :Homeview = Homeview()
    override func loadView() {
       us1 ? super.loadView() : setview()
    }
   private  func setview()
     {
    
    
        let bb = UIButton()
        bb.setTitle("返回", forState: UIControlState.Normal)
        bb.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal)
     view1.delega=self
     view = self.view1
      
        if self is Home{
        view1.startan()
            NSNotificationCenter.defaultCenter().addObserver(self, selector: "end", name:UIApplicationDidEnterBackgroundNotification, object: nil)
            NSNotificationCenter.defaultCenter().addObserver(self, selector: "start", name: UIApplicationDidBecomeActiveNotification, object: nil)
            
        }else if self is Message
        {
      view1.setcontroller("登陆后,别人评论你的微博,发给你的消息,都会显示在这里", image: "visitordiscover_image_message")
        }else if self is Extension
        {
  
        }else if self is Discovery
        {
            view1.setcontroller("登陆后最新,最热,微博尽在掌握,不会再与事实潮流擦肩而过", image: "visitordiscover_image_message")
        }else if self is Profol
        {
       view1.setcontroller("登陆后,你的微博，相册,个人资料将会显示在这里,展示给别人", image: "visitordiscover_image_profile")
        }
        
        self.navigationItem.leftBarButtonItem=UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "chilkzhuce")
        self.navigationItem.rightBarButtonItem=UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "chilklogin")
    }
   func start()
   {
   view1.start()
    }
    func end()
    {
 view1.pach()
    }
}



extension besiTableViewController : chilklazhomebutton
{
    func chilklogin()
    {
        presentViewController(mainNavigationController(rootViewController : OauthController()), animated: true, completion: nil)
    }
    func chilkzhuce() {
        
    }
}
